package edu.fh.salzburg.its.opsystems.newfs.implementation;


import edu.fh.salzburg.its.opsystems.newfs.definition.NewFSFile;

/**
 * represents a file in the NewFSFilesystem.<br>
 * the name is set by setName() and the path by 
 * @author muetze
 *
 */
public class MBRAFile extends NewFSFile {
	byte[] data;
	
	public MBRAFile(String name) {
		super();
		this.setName(name);
		this.setIdentifer(new String());
		this.setDatesNow();
	}

	public MBRAFile(NewFSDirEntry file) {
		super();
		this.setName(file.getName());
		this.setAttributes(file.getAttributes());
		this.setBuild(file.getBuild());
		this.setLastaccess(file.getLastaccess());
		this.setLastmod(file.getLastmod());
		this.setSize(file.getSize());
		this.setStartCluster(file.getStartCluster());
	}

	/**
	 * @return the data
	 */
	public byte[] getData() {
		return data;
	}

	/**
	 * @return the data
	 */
	public Byte[] getByteArray() {
		Byte[] dat = new Byte[data.length];
		for (int i=0; i<data.length; i++ ) {
			dat[i] = data[i];
		}
		return dat;
	}

	/**
	 * @param data the data to set
	 */
	public void setData(byte[] data) {
		this.data = data;
	}
	/**
	 * @param data the data to set
	 */
	public void setData(Byte[] data) {
		this.data = new byte[data.length];
		for (int i=0; i<data.length; i++) {
			this.data[i] = data[i];
		}
	}
}
